<%
  # Required Arguments:
  # => pageargs['twin_odds']
  #     The odds to be displayed
  
  proceed_odds = {}
  col_num = 0
  row_num = 0
  for odds in pageargs['twin_odds']:
    if odds.first_horse_no > col_num:
      col_num = odds.first_horse_no
    if odds.second_horse_no > row_num:
      row_num = odds.second_horse_no
    proceed_odds["%(first)d-%(second)d" % {'first': odds.first_horse_no, 'second': odds.second_horse_no}] = odds.odds
%>

<table>
  <tr>
    <th></th>
    % for i in range(1, col_num + 1):
    <th>${i}</th>
    % endfor
  </tr>
  % for i in range(2, row_num + 1):
  <tr>
    <th>${i}</th>
    % for j in range(1, col_num + 1):
    <% key = ("%(first)d-%(second)d" % {'first':j, 'second':i}) %>
    % if proceed_odds.has_key(key):
    <td>${proceed_odds[key]}</td>
    % else:
    <td></td>
    % endif
    % endfor
  </tr>
  % endfor
</table>